package com.bestcem.xm.ticket.service.manager.role;

import com.bestcem.xm.ticket.entity.mongo.TicketFlow;
import lombok.Getter;
import lombok.ToString;

import javax.annotation.Nullable;
import java.util.Objects;

/**
 * 工单规则 审核人 信息工具类
 *
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/17 20:14
 */
@ToString(callSuper = true)
@Getter
public class TicketAuditor extends BaseTicketRole {
    /**
     * 审核逾期处理为 继续等待
     */
    public static final Integer AUDIT_OVERDUE_WAIT = 0;
    /**
     * 审核逾期处理为 审核通过
     */
    public static final Integer AUDIT_OVERDUE_PASS = 1;

    /**
     * overdueHandle
     */
    private Integer overdueHandle;
    /**
     * emptyFollowerHandle
     */
    private Integer emptyFollowerHandle;


    /**
     * 构建实例
     *
     * @param followConfig 入参
     * @return 实例
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/8/20 16:01
     */
    @Nullable
    public static TicketAuditor getInstance(TicketFlow.FollowConfig followConfig) {
        if (Objects.isNull(followConfig)) {
            return null;
        }
        return new TicketAuditor(followConfig);
    }

    private TicketAuditor(TicketFlow.FollowConfig followConfig) {
        super(followConfig);
        if (Objects.isNull(followConfig)) {
            return;
        }
        this.overdueHandle = followConfig.getOverdueHandle();
        this.emptyFollowerHandle = AUDIT_OVERDUE_PASS;
    }
}
